<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<script src="js/mui.min.js"></script>
		<link href="css/mui.min.css" rel="stylesheet" />
		<script type="text/javascript" charset="utf-8">
			mui.init();
		</script>
		<style>
			button {
				display: block;
				margin-top: 10px;
				margin-bottom: 10px;
				margin-left: 20px;
				width: 40%;
			}
		</style>
	</head>

	<body>
		<h1>sub1</h1>
		<div style="width: 100%;">
			<button onclick="sendMsg_b1()" style="text-align: center;">sendMsg_b1</button>
			<button onclick="jump('sub2.html','sub2.html')">sub2</button>
		</div>

		<script src="js/mui.min.js"></script>
		<script src="js/ni.js"></script>
		<script>
			var broadcast = new ni.Broadcast()
			ni.ready(function() {
				console.log('ni ready')
			})
			ni.plusReady(function() {
				console.log('ni plusReady')
				broadcast.on('closePage', function(data) {
					 var curr = plus.webview.currentWebview();
					 curr.close();
				})
			})

			function sendMsg_b1() {
				broadcast.emit('b1', {
					msg: 'b1'
				}, {
					self: false, // 是否通知当前页面  默认不通知
					ids: ['index.html'] // 通知特定id的webview, 默认为全部
				})
			}
			
			function jump(pageId, url) {
				mui.openWindow({
					url: url,
					id: pageId,
					show: {
						autoShow: true,
						duration: 200
					}
				})
			};
			
		</script>
	</body>

</html>